Assignemnt #59 and 57th program
Code
///Name: Derrick Andreasen
///Period: 7
///Program name: 57th Program
///File name: Fift7Prog.java
///Date Finished:11/10/2015
import java.util.Random;
import java.util.Scanner;
public class Fift7Prog
{
public static void main( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int x, card;
System.out.println( "" );
System.out.println( "which card is the ace?" );
System.out.println( "" );
System.out.println( " ## ## ##" );
System.out.println( " ## ## ##" );
System.out.println( " 1 2 3 " );
System.out.println( "" );
System.out.print( "> " );
card = keyboard.nextInt();
System.out.println( "" );
x = 1 + r.nextInt(3);
if(card == x)
{
System.out.println( "You got it! Great job!" );
System.out.println( "" );
if(x == 1)
{
System.out.println( " AA ## ##" );
System.out.println( " AA ## ##" );
System.out.println( " 1 2 3 " );
System.out.println( "" );
}
else if(x == 2)
{
System.out.println( " ## AA ##" );
System.out.println( " ## AA ##" );
System.out.println( " 1 2 3 " );
System.out.println( "" );
}
else if(x == 3)
{
System.out.println( " ## ## AA" );
System.out.println( " ## ## AA" );
System.out.println( " 1 2 3 " );
System.out.println( "" );
}
}
else if(card != x)
{
System.out.println( "You chose wrong! the ace card was " + x + "." );
System.out.println( "" );
if(x == 1)
{
System.out.println( " AA ## ##" );
System.out.println( " AA ## ##" );
System.out.println( " 1 2 3 " );
System.out.println( "" );
}
else if(x == 2)
{
System.out.println( " ## AA ##" );
System.out.println( " ## AA ##" );
System.out.println( " 1 2 3 " );
System.out.println( "" );
}
else if(x == 3)
{
System.out.println( " ## ## AA" );
System.out.println( " ## ## AA" );
System.out.println( " 1 2 3 " );
System.out.println( "" );
}
}
}
}
Picture of the output